<template>
  <el-card class="app-container">
    <c-u-r-d-table :option="option" />
  </el-card>
</template>

<script>

import ColumnType from '@/framework/constant/ColumnType'
import { scenicSpotApi } from '@/feature/mj/infra/api/scenicSpotApi'
import CURDTable from '@/framework/components/table/CURDTable'
import { scenicSpotTagApi } from '@/feature/mj/infra/api/scenicSpotTagApi'
import TableButtonType from '@/framework/constant/TableButtonType'

export default {
  components: { CURDTable },
  data() {
    return {
      option: {
        requestApi: scenicSpotApi,
        showSelection: false,
        loadDetail: true,
        columns: [
          {
            label: '景点名',
            searchable: true,
            width: 100,
            required: true,
            prop: 'title'
          },
          {
            label: '别名',
            width: 120,
            required: true,
            span: 12,
            prop: 'aliasName'
          }, {
            label: '宣传语',
            required: true,
            span: 24,
            width: 'auto',
            prop: 'slogan',
            type: ColumnType.TEXTAREA
          },
          {
            label: '封面',
            span: 24,
            prop: 'cover',
            required: true,
            width: 80,
            type: ColumnType.IMAGE
          },
          {
            width: 110,
            label: '景点电话',
            prop: 'tel',
            type: ColumnType.TEXT
          },
          {
            label: '门票价格',
            prop: 'price',
            width: 80,
            required: true,
            type: ColumnType.MONEY
          },
          {
            label: '开放时间',
            prop: 'openTime',
            required: true,
            span: 24,
            type: ColumnType.TEXTAREA
          },
          // {
          //   label: '开放开始时间',
          //   prop: 'openStartTime',
          //   required: true,
          //   span: 12,
          //   type: ColumnType.TIME
          // }, {
          //   label: '开放结束时间',
          //   prop: 'openEndTime',
          //   required: true,
          //   span: 12,
          //   type: ColumnType.TIME
          // },
          {
            label: '景点地址',
            prop: 'address',
            required: true,
            span: 24,
            type: ColumnType.TEXTAREA
          },
          {
            width: 80,
            label: '经度',
            required: true,
            prop: 'longitude',
            type: ColumnType.NUMBER,
            renderOptions: {
              precision: 6,
              max: 180,
              min: 0
            }
          },
          {
            label: '纬度',
            required: true,
            type: ColumnType.NUMBER,
            width: 80,
            prop: 'latitude',
            renderOptions: {
              precision: 6,
              max: 90,
              min: 0
            }
          },
          {
            label: '标签',
            required: false,
            hiddenInTable: true,
            span: 24,
            type: ColumnType.MUL_SELECT,
            prop: 'tagIdList',
            dataType: 'array',
            options: scenicSpotTagApi.listAll()
          },
          {
            label: '图片',
            hiddenInTable: true,
            span: 24,
            required: true,
            type: ColumnType.IMAGE,
            limit: 10,
            prop: 'photoList',
            dataType: 'array'
          }, {
            label: '按钮内容',
            hiddenInTable: true,
            required: false,
            width: 120,
            prop: 'buttonText',
            type: ColumnType.TEXT
          }, {
            label: '按钮链接',
            viewAsLink: true,
            hiddenInTable: false,
            required: false,
            width: 160,
            prop: 'buttonLink',
            type: ColumnType.BUTTON_LINK
          }, {
            label: '视频',
            hiddenInTable: true,
            span: 24,
            required: false,
            type: ColumnType.IMAGE,
            limit: 10,
            prop: 'videoList',
            dataType: 'array'
          }, {
            label: 'VR',
            hiddenInTable: true,
            span: 24,
            required: false,
            type: ColumnType.IMAGE,
            limit: 10,
            prop: 'vrList',
            dataType: 'array'
          },
          {
            label: '景点介绍',
            span: 24,
            hiddenInTable: true,
            required: true,
            type: ColumnType.RICH_EDITOR,
            prop: 'intro'
          },
          {
            label: '创建时间',
            type: ColumnType.DATETIME,
            hiddenInForm: true,
            prop: 'gmtCreate'
          },
          {
            label: '修改时间',
            type: ColumnType.DATETIME,
            hiddenInForm: true,
            prop: 'gmtModified'
          }
        ]
      }
    }
  },
  methods: {}
}
</script>

